data Tree a = Node (Tree a) a (Tree a) | Leaf a | Nil

inOrden :: (Tree Int) -> [Int]
inOrden Nil = []
inOrden (Leaf x) = [x]
inOrden (Node hi r hd) = inOrden(hi) ++ [r] ++ inOrden(hd)

quickSort :: [Int] -> [Int]
quickSort [] = []
quickSort (x:xs) = quickSort([y| y <- xs, y <= x]) ++ [x] ++ quickSort([z| z <- xs, z > x])

listaRepetidos :: [Int] -> [(Int,Int)] -> [(Int,Int)]
listaRepetidos [] ys = ys
listaRepetidos (x:xs) [] = listaRepetidos xs [(x,1)]
listaRepetidos (x:xs) (y:ys) 
		| x == fst(y) = listaRepetidos xs ((x,snd(y)+1):ys)
		| otherwise   = listaRepetidos xs ((x,1):(y:ys))

masRepetido :: (Int,Int) -> [(Int,Int)] -> Int
masRepetido (a,b) [] = a
masRepetido (a,b) (x:xs)
	| b < snd (x) = masRepetido x xs
	| otherwise   = masRepetido (a,b) xs

mostrar :: [(Int,Int)] -> [Int]
mostrar [] = []
mostrar (x:xs) = [fst x,snd x] ++ mostrar xs

prim:: [(Int,Int)] -> (Int,Int)
prim (x:xs) = x

ult :: [(Int,Int)] -> [(Int,Int)]
ult (x:xs) = xs

f :: [Int] -> [Int] -> Int -> Bool
f xs ys x = analizar ws x
	where
		ws = [(a,b)| a <- xs, b <-ys]
		analizar [] n = False
		analizar (x:xs) n = (fst(x)+snd(x) == n) || analizar xs n

creciente :: [Int] -> [Int]
creciente [x] = [x]
creciente (x:(y:ys))
	| x < y = x:(creciente (y:ys))
	| otherwise = [x]

crec :: [Int] -> [[Int]]
crec [] = [[]]
crec (x:xs) = (creciente(x:xs)):(crec xs)
